/**
 * 功能:TK_DEPARTMENTS Service类
 * 开发人员:yaren
 * 创建时间:2012/4/21 20:57:36
 */
package com.towker.frame.service.basicData;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.stereotype.Service;
import com.towker.core.db.EntityDao;
import com.towker.core.db.BaseService;
import com.towker.frame.model.basicData.Departments;
import com.towker.frame.model.basicData.Depots;
import com.towker.frame.dao.basicData.DepartmentsDao;

@Service
public class DepartmentsService extends BaseService<Departments, java.lang.Long>
{
	private DepartmentsDao dao;
	
	public void setDepartmentsDao(DepartmentsDao dao)
	{
		this.dao = dao;
	}

	@SuppressWarnings("unchecked")
	@Override
	protected EntityDao getEntityDao()
	{
		return this.dao;
	}
	
	public Departments getByCode(String depCode) {
		return this.dao.getByCode(depCode);
	}

	public boolean checkExistsCode(String dep_code, Integer id) {
		return dao.checkExistsCode(dep_code, id);
	}
	
	public List<Departments> findByCoCode(String coCode) {
		Map<String, Object> map = new HashMap<String, Object>();
		map.put("co_code", coCode);
		return getList(map);
	}
}
